<template>
	<view>
		<view class="row-box" v-if="prod_flg=='N'">
			<view class="row-group">
				<view class="row">
					<view class="row-left">
						{{proName}}
					</view>
					<view class="row-right"></view>
				</view>
				<view class="row">
					<view class="row-left">
						业绩比较基准
					</view>
					<view class="row-right">{{whatToPro}}</view>
				</view>
				<view class="row">
					<view class="row-left">
						份额确认日	
					</view>
					<view class="row-right">{{querenDate}}</view>
				</view>
				<view class="row">
					<view class="row-left">
						购买日期
					</view>
					<view class="row-right">{{dakuanDate}}</view>
				</view>
				<view class="row">
					<view class="row-left">
						购买金额
					</view>
					<view class="row-right">{{buy_amt}}元</view>
				</view>
				<view class="row">
					<view class="row-left">
						购买份额
					</view>
					<view class="row-right">{{buy_share}}份</view>
				</view>
			</view>
			<view class="row-group" v-for="(item,key) in notjingzhiList">
				<view class="row">
				<view class="row-left">
					收益日期
				</view>
				<view class="row-right"><label class="color"> {{item.jingzhi_data_date}}</label class="color"></view>
			</view>
			<view class="row">
				<view class="row-left">
					收益金额
				</view>
				<view class="row-right"><label class="color">{{item.jingzhi_amount}}元</label class="color">{{ item.pay_sts}}</view>
			</view>
			</view>
			
		</view>
		<view class="row-box" v-if="prod_flg=='Y'">
			<view class="row-group">
				<view class="row">
					<view class="row-left">
						{{proName}}
					</view>	
				</view>
			</view>
			<view class="row-group" v-for="(item1,key) in jingzhiList">
				<view class="row">
					<view class="row-left">
						赎回日期
					</view>
					<view class="row-right">{{item1.sale_date}}</view>
				</view>
				<view class="row">
					<view class="row-left">
						赎回份额
					</view>
					<view class="row-right">{{item1.sale_share}}份</view>
				</view>
				<view class="row">
					<view class="row-left">
						收益
					</view>
					<view class="row-right">{{item1.profit}}元</view> 
				</view>
				
			</view>
		</view>
		
	</view>
</template>

<script>
	import global_wyx from '../../../../components/tool/licaishiwyx';
	export default {
		
		data() {
			return {
				// productClass:0,//产品类型 0为私募 1为月月盈
				prod_flg:'',
				c_reserveno:'',//缴款编号
				jingzhiList:[],
				notjingzhiList:[],
				proName:'',
				buy_amt:'',
				buy_share:'',
				dakuanDate:'',
				querenDate:'',
				whatToPro:''
			};
		},
		onLoad(item) {
			this.chicangInfo = item.chicangInfo;
			console.info("this.chicangInfo"+this.chicangInfo)
			var info = JSON.parse(this.chicangInfo);
			this.prod_flg = info.prod_flg;
			this.c_reserveno = info.c_reserveno;
			this.buy_amt = info.buy_amt;
			this.buy_share = info.buy_share;
			this.dakuanDate= info.dakuanDate;
			this.querenDate = info.querenDate;
			this.whatToPro = info.whatToPro;
			this.proName = info.prod_name;
			if(this.prod_flg=='N'){
				console.info("非净值")
				this.notjingzhi();
			}else if(this.prod_flg=='Y'){
			console.info("净值")
				this.jingzhi();
			}
		},
		methods: {
			goback() {
				uni.navigateBack()
			},
			toShouyijilu(){
				uni.navigateTo({
					url:'./shouyijilu/shouyijilu'
				})
			},
			notjingzhi(){
				//非净值
				uni.request({
					url: global_wyx.api.lcs_shouyixiangqing,
					method: 'POST',
					data: {
						c_reserveno:this.c_reserveno
					},
					header : {'content-type':'application/x-www-form-urlencoded'},
					success: res => {
						var resultData = res.data.data;
						// resultData.allProfit
						console.info("==================")
						console.info(JSON.stringify(resultData))
						var arr = resultData;
// 						var c = new Object();
// 						c.jingzhi_data_date='123';
// 						c.jingzhi_amount='123';
// 						arr.push(c);
						// this.proName='';
						this.notjingzhiList = arr;
						
// 						if(arr.length>0){
// 							this.proName = arr[0].proName;
// 						}
					},
					fail: () => {},
					complete: () => {}
				});
			},
			jingzhi(){
				//净值
				uni.request({
					url: global_wyx.api.lcs_shouyixiangqingJingzhi,
					method: 'POST',
					data: {
						c_reserveno:this.c_reserveno
					},
					header : {'content-type':'application/x-www-form-urlencoded'},
					success: res => {
						var resultData = res.data.data;
						// resultData.allProfit
						console.info("==================")
						console.info(JSON.stringify(resultData))
						var arr = resultData;
						this.jingzhiList = arr;
						this.proName='';
						if(arr.length>0){
							this.proName = arr[0].proName;
						}
					},
					fail: () => {},
					complete: () => {}
				});
			}
			
		}
	}
</script>

<style>
	page {
		

	}
	.row-box{
		margin-top:10px;
		
	}
	.row-group{
		margin-bottom: 10px;
		background:rgb(255,255,255);
		padding: 0 30upx;
	}
	.row{
		display:flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		border-bottom: 1px solid rgba(238,238,238,1);
		height: 39px;
		font-size: 15px;
	}
	.product-title{
		background: rgb(255,255,255);
		padding: 0 30upx;
	}
	.row-right{
		color: #999;
		font-size: 13px;
	}
	.color{
		color: #f7a900;
		margin-right: 10px;
	}
</style>
